﻿using EraNet.Core;
using EraNet.Data;
using EraNet.Core.Model.Account;
using EraNet.Services.Account;
using EraNet.Services.SysManage;
using EraNet.Common.Files;
using EraNet.Core.Model.SysManage;
using EraNet.Common;
using EraNet.Services.Drivings;
using EraNet.Services.Test;
using EraNet.Services.Messages;
using EraNet.WebApp.AppCore;
using EraNet.Core.Model.Messages;
using System.Web.Mvc;

namespace EraNet.WebApp.LMS
{
    public class MessagesController : LMSBasePage
    {
          #region Fields
        private readonly INoticeServices _noticeServices;
        private readonly IMemberService _memberervices;
        #endregion

        #region Constructors
        public MessagesController(INoticeServices noticeService, IMemberService memberervices)
        {
            this._noticeServices = noticeService;
            this._memberervices = memberervices;
        }
        #endregion


        public ActionResult NoticesInfo(int noticeId)
        {
            Member m = _memberervices.GetLoginMember();
            Notices n = _noticeServices.GetNoticeById(m.SchoolID,noticeId);

            return View(n);
        }

        public ActionResult Notices(int page=0)
        {
            Member m = _memberervices.GetLoginMember();

            var notice = _noticeServices.SelectPager(m.SchoolID, m.Id, page, 5);


            return View(notice);
        }
    }
}
